package com.hyfrogx.modules.app.controller.ios;

import com.hyfrogx.common.utils.R;
import com.hyfrogx.modules.app.form.ios.IosForm;
import com.hyfrogx.modules.manage.service.chargePayRecord.ChargePayRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Luo
 * @Date: 2019/12/16 10:59
 */
@RestController
@RequestMapping("api/charge")
@Api(value = "ApiIosRechargeController", tags = {"客户端--ios充值"})
public class ApiIosRechargeController {

    @Autowired
    ChargePayRecordService recordService;

    @ApiOperation("ios充值")
    @PostMapping("ios")
    public R iosCharge(@RequestBody IosForm form){
        try {
            Boolean aBoolean = recordService.iosCharge(form);
            if(aBoolean == null){
                return R.error(111,"错误的报文");
            }else if(aBoolean) {
                //请求成功
                return R.ok();
            }else{
                //请求成功
                return R.error(321,"重复校验");
            }

        }catch (Exception e){
            return R.error(e.getMessage());
        }
    }
}
